package BookStore.EBook.ConvertorForAndroid;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnection {
	
	private static String mJDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
	private static String mConnectDB="jdbc:sqlserver://localhost:1433;integratedSecurity=true;DatabaseName=EB";
	
	public static Connection getConnection(String server, String DBName, boolean isIntegratedSecurity, String userName, String password)
	{
		try{
            Class.forName(mJDriver);
        }catch(ClassNotFoundException e)
        {
        	e.printStackTrace();
        }
        
        String connectStr = "jdbc:sqlserver://" + server + ";integratedSecurity=" + isIntegratedSecurity + ";DatabaseName=" + DBName;
		
		Connection con = null;
		try {
			con = DriverManager.getConnection(connectStr,userName,password);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return con;
	}
}
